from flask import Flask
from common.database import init_app
from route.plants import plants_blueprint
from flask_cors import *

app = Flask(__name__)
CORS(app, supports_credentials=True)
app.config.from_pyfile('config.py')  # 从配置文件加载配置

init_app(app)  # 初始化数据库

# 注册蓝图
app.register_blueprint(plants_blueprint, url_prefix='/plants')

if __name__ == '__main__':
    app.run(debug=True)
